/*
**      Newton Developer Technical Support Sample Code
**
**      HandWrite, a Newton Works word processor tool sample
**
**      by Paul Rekieta and Ryan Robertson, Newton Developer Technical Support
**
**      Copyright  1997 by Apple Computer, Inc.  All rights reserved.
**
**      You may incorporate this sample code into your applications without
**      restriction.  This sample code has been provided "AS IS" and the
**      responsibility for its operation is 100% yours.  You are not
**      permitted to modify and redistribute the source as "DTS Sample Code."
**      If you are going to re-distribute the source, we require that you
**      make it clear in the source that the code was descended from
**      Apple-provided sample code, but that you've made changes.
*/

// This is the definition of this particular Newton Work's word processor tool.
DefineGlobalConstant( 'kToolFrame, 
{
	item: 				"Hand Write",			// Will show up in the 'Tools' button.
	dataTypeSymbol: 	'paper,					// Needed so that Newton Works know what stationery this tool is for.
	cmdFunc: 			func( viewDefView, newtAppBase )
							begin
								// Grab the layout and send it a "New" message.  This will
								// open the writing view.
								GetLayout("HandWrite.lyt"):New( viewDefView, newtAppBase );
							end
});


InstallScript := func(partFrame, removeFrame)
begin
	// If Newton Works is installed then register the tool.
	// Note: when using RegNewtWorksTool, you must EnsureInternal the app symbol. 
	if GetRoot().newtWorks then
		GetRoot().newtWorks:RegNewtWorksTool( EnsureInternal(kAppSymbol), kToolFrame );
end;

RemoveScript := func(removeFrame)
begin
	// If Newton Works is installed, then unregister the tool.
	if GetRoot().newtWorks then
		GetRoot().newtWorks:UnregNewtWorksTool( kAppSymbol );
end;